package se.jayway.millionaire.internal.game;

import java.util.List;

import se.jayway.millionaire.model.game.Answer;
import se.jayway.millionaire.model.game.Question;

public class SimpleQuestion implements Question {

	private final String text;
	private final List<Answer> answerAlternatives;
	private final int correctAnswerIndex;
	
	public SimpleQuestion(String text, List<Answer> answerAlternatives, int correctAnswerIndex) {
		this.text = text;
		this.answerAlternatives = answerAlternatives;
		this.correctAnswerIndex = correctAnswerIndex;
	}

	public String getText() {
		return text;
	}
	
	public Answer[] getAnswerAlternatives() {
		return answerAlternatives.toArray(new Answer[answerAlternatives.size()]);
	}
	
	public boolean isCorrect(Answer answer) {
		return answer == answerAlternatives.get(correctAnswerIndex);
	}
}
